package com.cl.service.impl;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
import java.util.List;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cl.utils.PageUtils;
import com.cl.utils.Query;


import com.cl.dao.WangzhantiaozhuanDao;
import com.cl.entity.WangzhantiaozhuanEntity;
import com.cl.service.WangzhantiaozhuanService;
import com.cl.entity.view.WangzhantiaozhuanView;

@Service("wangzhantiaozhuanService")
public class WangzhantiaozhuanServiceImpl extends ServiceImpl<WangzhantiaozhuanDao, WangzhantiaozhuanEntity> implements WangzhantiaozhuanService {

    	
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<WangzhantiaozhuanEntity> page = this.selectPage(
                new Query<WangzhantiaozhuanEntity>(params).getPage(),
                new EntityWrapper<WangzhantiaozhuanEntity>()
        );
        return new PageUtils(page);
    }
    
    @Override
	public PageUtils queryPage(Map<String, Object> params, Wrapper<WangzhantiaozhuanEntity> wrapper) {
		  Page<WangzhantiaozhuanView> page =new Query<WangzhantiaozhuanView>(params).getPage();
	        page.setRecords(baseMapper.selectListView(page,wrapper));
	    	PageUtils pageUtil = new PageUtils(page);
	    	return pageUtil;
 	}
    
	@Override
	public List<WangzhantiaozhuanView> selectListView(Wrapper<WangzhantiaozhuanEntity> wrapper) {
		return baseMapper.selectListView(wrapper);
	}

	@Override
	public WangzhantiaozhuanView selectView(Wrapper<WangzhantiaozhuanEntity> wrapper) {
		return baseMapper.selectView(wrapper);
	}

	@Override
	public PageUtils selectHTTP() {
		HashMap<String,Object> map = new HashMap<>();
		Page<WangzhantiaozhuanView> page =new Query<WangzhantiaozhuanView>(map).getPage();
		page.setRecords(baseMapper.selectHTTP());
		return new PageUtils(page);
	}


}
